package com.lepu.app.fun.my.bean;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;


public class BeanPubContentComment {

	public String UserID;
	public String UserNickName;
	public String UserAvatar;//用户头像
	
	public String ReplyID;
	public String ReplyContent;
	public String RecordCreateTime;
	
	public String FavourCount;  //点赞次数
	public String HasFavour;  //是否点赞
	
	public String Storey; //楼层
	
	public String IsForbidden;//0不禁言；1禁言
	
	public BeanPubContentCommentReply QuoteReply;
	
	public static ArrayList<BeanPubContentComment> parseJsonData(String dataString)
	{
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONArray obj2 = (JSONArray) obj1.get("ListInfo");

			result = obj2.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}

		Gson gson = new Gson();
		ArrayList<BeanPubContentComment> testArraylist = gson.fromJson(result,
				new TypeToken<List<BeanPubContentComment>>() {
				}.getType());
		return testArraylist;
	}
	
	public static ArrayList<BeanPubContentComment> parseJsonHotData(String dataString)
	{
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONArray obj2 = (JSONArray) obj1.get("HotReplyListInfo");

			result = obj2.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}

		Gson gson = new Gson();
		ArrayList<BeanPubContentComment> testArraylist = gson.fromJson(result,
				new TypeToken<List<BeanPubContentComment>>() {
				}.getType());
		return testArraylist;
	}
	
	
	public static BeanPubContentComment parseJsonSimpleData(String dataString)
	{
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONObject obj2 = (JSONObject) obj1.get("DetailInfo");
			
			result = obj2.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		Gson gson = new Gson();
		BeanPubContentComment item = gson.fromJson(result,
				new TypeToken<BeanPubContentComment>() {
				}.getType());
		return item;
	}
}
